from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select

test1=webdriver.Chrome()
test1.get("http://116.62.125.96/zentao/user-login-L3plbnRhby8=.html?tid=xuc7908o")
sleep(5)
test1.maximize_window()
test1.find_element(By.XPATH,"//*[@id='account']").send_keys("liruyue")
sleep(3)
test1.find_element(By.NAME,"password").send_keys("Test1234")
sleep(3)
test1.find_element(By.ID,"submit").click()
sleep(3)
test1.find_element(By.XPATH,"//*[@id='menuMainNav']/li[3]/a").click()
sleep(3)
test1.switch_to.frame('appIframe-product')
sleep(3)
test1.find_element(By.XPATH,"//*[@id='mainMenu']/div[2]/a[2]").click()
sleep(3)
test1.find_element(By.XPATH,"//*[@id='name']").send_keys("测试1")
sleep(3)
test1.find_element(By.XPATH,"//*[@id='code']").send_keys("12345")
sleep(3)
js= "document.getElementById(\"PO\").style.display='block';"
test1.execute_script(js)
s1=test1.find_element(By.ID,"PO")
Select(s1).select_by_value("liruyue")
sleep(2)
js1= "document.getElementById(\"QD\").style.display='block';"
test1.execute_script(js1)
s2=test1.find_element(By.ID,"QD")
Select(s2).select_by_index(1)
sleep(2)
js2= "document.getElementById(\"RD\").style.display='block';"
test1.execute_script(js2)
s3=test1.find_element(By.ID,"RD")
Select(s3).select_by_index(1)
sleep(2)
test1.find_element(By.XPATH,"//*[@id='submit']").click()
sleep(2)
test1.quit()
